import { ecs } from "../../core/ecs/ECS";
import { RoomModel } from "./model/RoomModel";

/** 房间 */
@ecs.register(`Room`)
export class Room extends ecs.Entity {

    public static RID:number = 0;
    RoomModel:RoomModel = null!;
    init() {
        this.addComponents<ecs.Comp>(RoomModel);
        this.RoomModel.roomId = ++Room.RID;
    }

    //加入房间
    joinRoom(userKey: number) {
        this.RoomModel.users.add(userKey);
    }

    broadcast() {
        
    }
}